home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / zmdm.zoo / zmdm.h < prev    next >
C/C++ Source or Header  |  1991-04-27  |  4KB  |  193 lines

  1. /*
  2.  *     Common include file
  3.  *
  4.  *
  5.  * bang:   uunet!cadence!bammi            jwahar r. bammi
  6.  * domain: bammi@cadence.com
  7.  * GEnie:    J.Bammi
  8.  * CIS:    71515,155
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include <ctype.h>
  13. #include <setjmp.h>
  14. #include <osbind.h>
  15. #include "decl.h"
  16.  
  17.     /* See configurable parameters towards the end of the file */
  18.     /* Leave the rest alone                      */
  19.  
  20.  
  21.     
  22.      /* Common defines */
  23. #ifdef FALSE
  24. #undef FALSE
  25. #endif
  26. #ifdef TRUE
  27. #undef TRUE
  28. #endif
  29. #define    FALSE         0
  30. #define TRUE         1
  31.  
  32.  
  33. #define EscSeq(x)    Bconout(2,(int)'\033'); Bconout(2,(int)x) /* Send Esc.
  34.                             Seq. to     console */
  35. #define CTRL(X)        (X & 037) /* CTRL-anything */
  36.  
  37. #define STOS          "GEMDOS/TOS"
  38. #define ZMDMVERSION    "$Revision: 1.76 $ $Date: 1991/04/27 22:12:49 $"
  39.  
  40. /* Ward Christensen / CP/M parameters - Don't change these! */
  41. #define ENQ 005
  42. #define CAN ('X'&037)
  43. #define XOFF ('s'&037)
  44. #define XON ('q'&037)
  45. #define SOH 1
  46. #define STX 2
  47. #define EOT 4
  48. #define ACK 6
  49. #define NAK 025
  50. #define CPMEOF 032
  51. #define WANTCRC 0103    /* send C not NAK to get crc not checksum */
  52. #define WANTG 0107    /* Send G not NAK to get nonstop batch xmsn */
  53. #define TIMEOUT (-2)
  54. #define RCDO (-3)
  55. #define GCOUNT (-4)
  56. /* #define ERRORMAX 5 */
  57. #define RETRYMAX 10    /* for dogs like compuserve */
  58. #define WCEOT (-10)
  59. #define SECSIZ 128    /* cp/m's Magic Number record size */
  60. #define PATHLEN 128    /* ready for 4.2 bsd ? noooooo */
  61. #define KSIZE 1024    /* record size with k option */
  62. #define UNIXFILE 0x8000    /* happens to the the S_IFREG file mask bit for stat */
  63. #define DEFBYTL 2000000000L    /* default rx file size */
  64. #define WANTG 0107    /* Send G not NAK to get nonstop batch xmsn */
  65. #define TXBSIZE 16384
  66.  
  67. #define PURGELINE    while(Bconstat(1))Bconin(1);Lleft = 0
  68.  
  69. #define Bauxws(X)     wr_modem(X)
  70.  
  71. #define RLOGFILE "rzlog"
  72. #define zperr vfile
  73. #define zperr2 vfile2
  74.  
  75. #define OK 0
  76.  
  77. #ifdef ERROR
  78. #undef ERROR
  79. #endif
  80. #define ERROR (-1)
  81.  
  82. #define HOWMANY 133
  83. /* Parameters for ZSINIT frame */
  84. #define ZATTNLEN 32    /* Max length of attention string */
  85.  
  86.      
  87.      /* Types */
  88.  
  89. #ifdef LONG
  90. #undef LONG    /* Get rid of stupid portab.h definition */
  91. #endif
  92.  
  93. #ifdef WORD
  94. #undef WORD
  95. #endif
  96.  
  97. #ifdef UWORD
  98. #undef UWORD
  99. #endif
  100.  
  101. struct    stat
  102. {
  103.     char    st_sp1[21];    /* Junk        */
  104.     char    st_mode;       /* File attributes */
  105.     short    st_time;       /* Mod Time      */
  106.     short   st_date;       /* Mod date      */
  107.     long    st_size;       /* File size       */
  108.     char    st_name[14];   /* File name       */
  109. };
  110.  
  111. /* The structure returned by Iorec(), really ptr to this type */
  112. typedef struct {
  113.     char  *ibuf;    /* input */
  114.     short ibufsiz;
  115.     short ibufhd;
  116.     short ibuftl;
  117.     short ibuflow;
  118.     short ibufhi;
  119.  
  120. } IOREC;
  121.  
  122. typedef  struct {
  123.     char *sbaud;
  124.     int  ibaud;
  125.     int  jbaud;
  126. } BAUDS;
  127.  
  128. #ifdef    FLOW_CTRL
  129. typedef    struct {
  130.     char *sflow;
  131.     int  iflow;
  132. } FLOWS;
  133. #endif
  134.  
  135. #ifdef    HIBAUD
  136. typedef    struct {
  137.     char tdc;
  138.     char tdd;
  139. } CBAUD;
  140. #endif
  141.  
  142.  
  143. /*
  144.  * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. 
  145.  *  NOTE: First srgument must be in range 0 to 255.
  146.  *        Second argument is referenced twice.
  147.  * 
  148.  * Programmers may incorporate any or all code into their programs, 
  149.  * giving proper credit within the source. Publication of the 
  150.  * source routines is permitted so long as proper credit is given 
  151.  * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, 
  152.  * Omen Technology.
  153.  */
  154. #ifndef IN_COMMON
  155. extern unsigned short crctab[]; /* see definition in common.c */
  156. extern unsigned long int crc_32_tab[]; /* see definition in common.c */
  157. #endif
  158.  
  159. #define updcrc(cp, crc) \
  160. ( crctab[(((unsigned short)crc >> 8) & 255)] ^ ((unsigned short)crc << 8) ^ (unsigned short)cp)
  161.  
  162. #define UPDC32(octet, crc) \
  163. (crc_32_tab[(((unsigned long)crc) ^ ((unsigned long)octet)) & 0xff] ^ (((unsigned long)crc) >> 8))
  164.  
  165. #ifdef    FLOW_CTRL
  166. #define    FLOW_STRING(s)    ((s < 0) ? "none" : vflows[s].sflow)
  167. #endif
  168.  
  169. #define BAUD_STRING(s)    ((s < 0) ? "**UNKNOWN**" : vbauds[s].sbaud)
  170. #define BAUD_RATE(s)    ((s < 0) ? 9600 : vbauds[s].jbaud)
  171.  
  172. #ifdef __GNUC__
  173.  
  174. extern int SendType;
  175. extern int Wcsmask;
  176.  
  177. inline static void sendline(c)
  178. int c;
  179. {
  180.     if (SendType)
  181.         Bconout(1, c & Wcsmask);
  182.     else
  183.         Bconout(1, c);
  184. }
  185.  
  186. inline static void flush_modem()
  187. {
  188.     while(Bcostat(1) == 0);
  189. }
  190. #endif /* __GNUC__ */
  191.  
  192. /* -eof- */
  193.